#pragma once

class SCRCamera;
class SCRGameStateManager;
class SCRResourceManager;
struct SCRGameData;
struct SDL_Surface;

#if defined(_DEBUG)
#include "scr_profiler.h"
#define SCR_PROFILER(name) SCRProfiler Profiler##name (#name, __FILE__, __LINE__)
#else
#define SCR_PROFILER(name)
#endif

class SCRGame
{
public:

	static const int SCR_SCREEN_WIDTH = 1024;
	static const int SCR_SCREEN_HEIGHT = 768;
	static const int SCR_SCREEN_BPP = 16;

	~SCRGame();
	static SCRGame* GetInstance();
	static void CreateInstance();
	static void DestroyInstance();
	bool Initialize();
	void Terminate();
	void Run();
	void Quit();
	void Clear(const char& Red = 0, const char& Green = 0, const char& Blue = 0);
	SCRCamera* GetCamera() const;
	SCRGameStateManager* GetStateManager() const;
	SCRResourceManager* GetResourceManager() const;
	SDL_Surface* GetScreen() const;
	SCRGameData* GetSharedData() const;
	void CreateSharedData();
	void DestroySharedData();

private:

	SCRGame();

	static SCRGame* m_pInstance;
	SCRCamera* m_pCamera;
	SCRGameStateManager* m_pStateManager;
	SCRResourceManager* m_pResourceManager;
	SDL_Surface* m_pScreen;
	bool m_ShouldQuit;
	SCRGameData* m_pSharedData;
};

inline SCRGame* SCRGame::GetInstance()
{
	return m_pInstance;
}

inline SCRCamera* SCRGame::GetCamera() const
{
	return m_pCamera;
}

inline SCRGameStateManager* SCRGame::GetStateManager() const
{
	return m_pStateManager;
}

inline SCRResourceManager* SCRGame::GetResourceManager() const
{
	return m_pResourceManager;
}

inline SDL_Surface* SCRGame::GetScreen() const
{
	return m_pScreen;
}

inline SCRGameData* SCRGame::GetSharedData() const
{
	return m_pSharedData;
}
